//
//  WPKindsCollectionViewCell.m
//  ZhongChouPingTai
//
//  Created by WeiPan on 16/4/5.
//  Copyright © 2016年 HuaYiSoftware. All rights reserved.
//

#import "WPKindsCollectionViewCell.h"

@interface WPKindsCollectionViewCell ()
- (void)initializeAppearance;/**< 一般界面初始化 */
@end
@implementation WPKindsCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self initializeAppearance];
    }
    return self;
}
#pragma mark - 初始化
- (void)initializeAppearance {
    [self addSubview:self.cellTitleLabel];
}
#pragma mark - responds events
- (void)respondsToKindBtn:(UIButton *)sender {
    sender.selected = !sender.selected;
}
#pragma mark - getter
- (UILabel *)cellTitleLabel {
    if (!_cellTitleLabel) {
        _cellTitleLabel = ({
            UILabel * lab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
            lab.font = [UIFont systemFontOfSize:14*DHFlexibleHorizontalMutiplier()];
            lab.textColor = COLOR_RGB(211, 211, 211, 1);
            lab.textAlignment = NSTextAlignmentCenter;
            lab;
        });
    }
    return _cellTitleLabel;
}
- (UIButton *)kindBtn {
    if (!_kindBtn) {
        _kindBtn = ({
            UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
            btn.bounds = CGRectMake(0, 0, 60*DHFlexibleHorizontalMutiplier(), 30*DHFlexibleHorizontalMutiplier());
            btn.center = CGPointMake(self.bounds.size.width/2.0, self.bounds.size.height/2.0);
            [btn setTitleColor:COLOR_RGB(211, 211, 211, 1) forState:UIControlStateNormal];
            [btn setTitleColor:COLOR_RGB(234, 0, 30, 1) forState:UIControlStateSelected];
            btn.titleLabel.font = [UIFont systemFontOfSize:11*DHFlexibleHorizontalMutiplier()];
            [btn addTarget:self action:@selector(respondsToKindBtn:) forControlEvents:UIControlEventTouchUpInside];
            btn;
        });
    }
    return _kindBtn;
}
@end
